﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCvoucherAsp;

namespace MVCvoucherAsp.Controllers
{ 
    public class btcForUserController : Controller
    {
        private VoucherDbEntities1 db = new VoucherDbEntities1();

        //
        // GET: /btcForUser/

        public ViewResult Index(Voucher voucher)
        {
          
           ViewBag.BtcId = new SelectList(db.BTC, "BtcId", "BtcNaam");
           return View();

            //var voucher = db.Voucher.Include("BTC");
            //return View(voucher.ToList());
        }

        //
        // GET: /btcForUser/Details/5

        public ViewResult Details(int id)
        {
            Voucher voucher = db.Voucher.Single(v => v.VoucherId == id);
            return View(voucher);
        }

        public ViewResult ViewVoucher(int id) 
        {
           var voucher = db.Voucher.Where(v => v.BtcId == id); 
            return View(voucher.ToList());
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}